<extend name="Layout/ins_page" />
   
<block name="content">

 <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
<form method="post" name="form_adv_search" id="form_adv_search">

	<div class="adv_search panel panel-default " id="adv_search">
	
		<div class="panel-heading">
			<div class="row">
				<h4 class="col-xs-6">搜索</h4>
				<div class="col-xs-6 text-right">
					<a  class="btn btn-sm btn-info" onclick="submit_adv_search();">搜索</a>
					<a  class="btn btn-sm" onclick="close_adv_search();">关闭</a>
				</div>
			</div>
		</div>
		<div class="panel-body">
		<div class="form-group col-sm-6">
				<label class="col-sm-4 control-label" for="type">状态：</label>
				<div class="col-sm-8">
					<select class="form-control" name="eq_type">
						<option value="-8" <?php if($status==-8){ echo "selected='selected'";}?>>所有申请单</option>
						<option value="1" <?php if($status==1){ echo "selected='selected'";}?> >等待审核</option>
						<option value="2"<?php if($status==2){ echo "selected='selected'";}?> >审核通过</option>
						<option value="-1"<?php if($status==-1){ echo "selected='selected'";}?> >审核未通过</option>	
					</select>
				</div>
				
				
				
			</div>
			
			<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="li_name">关键字：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="" name="keyword" value="<?php echo $keyword;?>">
					</div>
				</div>

		</div>
	</div>

<div class="ul_table ul_table_responsive" style="font-size:14px" >
	<ul>
		<li class="thead" style="padding-left:10px">
			<div class="autocut auto">
			    <span class="col-18 ">编号</span>
				<span class="col-10 ">用户</span>
				<span class="col-18 ">状态</span>
				<span class="col-16 ">申请时间</span>
				<span class="col-16 ">供应商名称</span>
			    <span class="col-8 ">物料总数</span>
				<span class="col-8 ">总价(元)</span>
				 <span class="col-8 ">SAP单号</span>
			    <span class="col-8 ">操作</span>
			</div>
			
		</li>
	</ul>
	<empty name="list">
		<ul>
			<li class="no-data">
				没找到数据
			</li>
		</ul>
		<else/>
		<form method="post" action="" name="form_data" id="form_data">
			<ul>
			
				<?php foreach($list as $vo){
				
				?>
					<li class="tbody ">

                        <if condition="$vo['is_urgent']">
                            <div class="autocut auto" style="background-color: #2fd85e">
                            <else/>
                            <div class="autocut auto">
                        </if>

						    <span class="col-18 "><?php echo $vo['name']?>&nbsp;</span>
							<span class="col-10 "><?php echo $vo['user']?>&nbsp;</span>
							<span class="col-18 "><?php echo $vo['status']==1?"等待".$vo['to_user']."审核":($vo['status']==2?"<span style='color:green'>通过</span>":"<span style='color:red'>未通过</span>") ?>&nbsp;</span>
							<span class="col-16 "><?php echo $vo['ctime']?></span>
							<span class="col-16 " style="overflow: hidden;"><?php echo $vo['suppliers_name']?></span>
						    <span class="col-8 " <?php if($vo['item_count']>=1000){echo "style='color:red'";}?> >&nbsp;&nbsp; <?php echo $vo['item_count']?>&nbsp;</span>
							<span class="col-8 " <?php if($vo['price_total']>=50000){echo "style='color:red'";}?> ><?php echo $vo['price_total']?>&nbsp;</span>
							<span class="col-8"  ><?php echo $vo['sap_code']?>&nbsp;</span>
							
							<span class="col-8 ">
							<a href="/index.php?m=&c=stocking&a=info&id=<?php echo $vo['id']?>"  >查看</a>
                            <a href="/index.php?m=&c=stocking&a=getinfoandexport&id=<?php echo $vo['id']?>"  >导出</a>
							<?php if($vo['step']==0&&$vo['user']==$curr_user){?>
							<a href="javascript:void(0)" class='removesk' data-id="<?php echo $vo['id']?>" >删除</a>
							<?php }?>
							<a href="/index.php?m=&c=stocking&a=clonedata&id=<?php echo $vo['id']?>"  >复制</a>
							</span>
							 </div>
					</li>
				<?php } ?>
			</ul>
		</form>
		<div class="pagination">
			{$page}
		</div>
	</empty>
</div>
</form>
    <div style="right:20px; top:88px; position:absolute;display: none;z-index: 99999;background-color: #ffffff;box-shadow: -2px 10px 10px  #888888;-moz-box-shadow: -2px 10px 10px #888888;" id='qdan-show'>
                <div id="grid2" class="mini-datagrid" style="width:600px;height:500px;border: 1px solid gray"                     
                    idField="id"  multiSelect="true" showPager="false"
                    allowCellEdit="true" allowCellSelect="true" 
                >
                    <div property="columns">
                        <div type="checkcolumn"></div>
                         <div header="物料编号" field="code" width="80px"></div>
                         <div header="物料名称" field="name"  width="200px"></div>
                            
                        </div>
                    </div>
                   &nbsp; <input type="button" value="移除所选物料" onclick="removes()" style="width:100px;"/> &nbsp;&nbsp;<a  href='javascript:void(0)' class='close_show' >关闭</a>
    </div>
    
    


<script type="text/javascript">
mini.parse();
        $('.removesk').click(function(){
        	var id = $(this).attr('data-id');
        	 
        	  mini.confirm("确定删除?", "确定？",
      	            function (action) {
      	                if (action == "ok") {
      	                  $.ajax({
      	                    url: "/Stocking/delete",
      	                    data: { id: id},
      	                    type: "post",
      	                    async: false,
      	                    success: function (data) {
      	                    	if(data>=2){
      	                    		location.reload();
      	                    	}else{
      	                    		mini.alert('删除失败');
      	                    	}
      	                    },
      	                    error: function (jqXHR, textStatus, errorThrown) {
      	                        alert(jqXHR.responseText);
      	                    }
      	                });
      	            	
      	                }
      	            }
      	        );
        	
        	
        	
        	
          
     	          
        	 
        })
    </script>
</block>

  

